package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfigData struct {
	Mysql struct {
		User     string
		Password string
		Host     string
		Port     int
		Database string
	}
	Redis struct {
		Addr     string
		Password string
		DB       int
	}
}

var ViperData AppConfigData

func GHetViperData() {
	viper.SetConfigFile("./appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
	err = viper.Unmarshal(&ViperData)
	if err != nil {
		panic(err)
	}
	fmt.Println(ViperData)
}
